<%@ page language="java" import="java.util.*,com.king.cms.common.*" pageEncoding="utf-8"%>
<%@ include file="/hotel/include/css.jsp"%><%-- /*包含css样式表*/ --%>
 
<html>
<head>
<title>上传文件</title>

<script language="javascript">
  function docheck(){

   if(form1.fileupload.value == "")
   {
	alert("未选择上传文件");return;
   }
   var objfile=form1.fileupload.value;
   var filetype = form1.fileType.value;
   var length=objfile.length;
   var startpos=objfile.lastIndexOf('.');
   var suffix=objfile.substring(startpos,length);
   if(filetype == '0'){
	   if((suffix.toUpperCase()==".GIF") || (suffix.toUpperCase()==".JPG") || (suffix.toUpperCase()==".BMP")){
	    //return true;
		}else{
	     alert("只能上传GIF、BMP或JPG文件图像文件。");
	     return false;
	    }
	}
    if(filetype == '1'){
	   if(suffix.toUpperCase()==".PPS"){
	    //return true;
		}else{
	     alert("只能上传PPS文件,如果是PPT文件，请在PowerPoint中另存为PPS文件再上传。");
	     return false;
	    }
   }  
	form1.action = '<%=path %>/templateupload.do';
	form1.submit(); 
	
 } 
 function buttondisable(){
    var filetype = form1.fileType.value;
    var obj = window.opener.document.getElementById("previewbutton");
     
    if(filetype == 0)
       obj.disabled = false;
     if(filetype == 1)
       obj.disabled = true;
 }
 
</script>
</head>
<body>
<center>
<BR>
<form name="form1" enctype="multipart/form-data" method="post" action="">
<table border="0" cellpadding="4" cellspacing="1" style="border-collapse: collapse; width:400" bordercolor="#111111" class="bg_table" width="80%" height="180" align="center">
  <tr>
    <td class="top_td" colspan="3" align="center"></td>
  </tr> 
 <tr class="td2"> 
    <td width="100%" colspan="3" align="center"><b>文件上传</b></td>
     
  </tr>  
  <tr class="td2"> 
    <td width="20%">选择文件</td>
    <td width="70%" align="left"> 
    <input type="file" name="fileupload" size="70"   style="width:80%"  class="area100"  UNSELECTABLE="on">
    
    </td>
     <td width="10%"><select name="fileType" onchange="buttondisable()"><option value="0">图片</option><option value="1">PPS</option></select></td>
  </tr>  
   
  <tr class="td2"> 
    <td colspan="3" align="middle">
	 
	<input type="button"   value="上传文件" class="area100" onclick="docheck()" >
	 
 
 </td>
  </tr>
  <tr>
    <td class="top_td" colspan="3" align="center"></td>
  </tr>
</table>
</form>
</center>
</body>
</html>